package com.albaba.designpattern.visitor.text_001;

import java.lang.reflect.Array;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

/**
 * @Description: TODO
 * @Author zx
 * @Date 2025/2/25 18:32
 * @Version 1.0
 */
public class Client {

    public static void main(String[] args) {
        // Candy candy = new Candy("德芙巧克力", LocalDate.of(2025, 2, 25), 100);
        // Visitor visitor = new DiscountVisitor(LocalDate.now());
        // visitor.visit(candy);

        // 模拟添加多个商品
        List<Acceptable> products = Arrays.asList(
                new Candy("德芙巧克力", LocalDate.of(2025, 2, 25), 100),
                new Wine("白兰地", LocalDate.of(2025, 2, 25), 100),
                new Fruit("苹果", LocalDate.of(2025, 2, 25), 100, 20)
        );

        Visitor visitor = new DiscountVisitor(LocalDate.of(2025, 2, 25));

        for (Acceptable product : products) {
            product.accept(visitor);
        }

    }
}
